<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="Step 1: Enabling the Archive Mode">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="en-us_topic_0000002164620264.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="">
<meta name="DC.Publisher" content="20250306">
<meta name="prodname" content="csbs">
<meta name="documenttype" content="usermanual">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="EN-US_TOPIC_0000002200021049">
<meta name="DC.Language" content="en-us">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>Step 1: Enabling the Archive Mode</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="EN-US_TOPIC_0000002200021049"></a><a name="EN-US_TOPIC_0000002200021049"></a>

<h1 class="topictitle1">Step 1: Enabling the Archive Mode</h1>
<div><p id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_p1134163814529">Before backing up the database, you must enable the archive mode. Otherwise, the backup fails.</p>
<div class="section" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_section15213181415318"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_ol516055662416"><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li716035617240">Use PuTTY to log in to the Kingbase database host.</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li14621131213268">Create a path for storing archive logs (WALs). The <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b15538533144916">/mnt/server/archivedir/</strong> path is used as an example in subsequent operations.<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen156211512152614">mkdir -p<em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_i166211312132615"> /mnt/server/archivedir/</em></pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li1281642882814">Assign the read and write permissions to the database installation user <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b19986838132113">k</strong><strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1986538102110">ingbase</strong>. The following operations use the database installation username <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b203619516225">k</strong><strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b143610511221">ingbase</strong> as an example.<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen481612814288">chmod 750 <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_i138161428172810">/mnt/server/archivedir/</em>
chown kingbase:kingbase <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_i14816928182820">/mnt/server/archivedir/</em></pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li1725354622819">Run <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b1025313461280">su kingbase</strong> to switch to the database installation user <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1871123613816">kingbase</strong>. The command output is as follows:<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen2025334619289">[root@localhost ~]# su kingbase
bash-4.1$ </pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li055635710288">Run the following command to log in to the database. In the command, <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1457713885111">54321</strong> is the default port number, <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1142431215116">test123</strong> is the name of the database user, and <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1656101935113">test</strong> is the database name. Replace them with the actual values.<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen10556157132811"><em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i139266221549">/</em><em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i272717468144">Installation directory</em>/bin/ksql -p <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i18520125172">54321</em> -U <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i1714118817174">test123</em> <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i167151351716">test</em></pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_li149221537161910">Enter the password of the database user <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1765212961812">test123</strong>.</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li149541783295">Run <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b1895418112914">show config_file</strong><strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b1595414842918">;</strong> to query the path to the <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b328887165212">kingbase.conf</strong> file. The command output is as follows:<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen149544813295">test=# show config_file ;
                    config_file                     
----------------------------------------------------
 /home/kingbase/cluster/kingbase/data/kingbase.conf
(One record)
test=# </pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li17263199293">Press <span class="uicontrol" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_uicontrol173011037123011"><b>Ctrl+d</b></span> to log out of the database installation user <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b868671318191">kingbase</strong> and log in to the Kingbase database host.</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li178718287297">Open the <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b1510712465319">kingbase.conf</strong> file. The <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_b957108125319">/home/kingbase/cluster/kingbase/data/kingbase.conf</strong> path is used as an example.<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen1178792816293">vi <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i1124357112017">/home/kingbase/cluster/kingbase/data/kingbase.conf</em></pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_li380174213292">Find and modify the <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b13671125815452">wal_level</strong>, <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b12801519468">archive_mode</strong>, and <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b14669636469">archive_command</strong> parameters in the <strong id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_b125611551468">kingbase.conf</strong> file as follows:<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_en-us_topic_0000001607842332_screen16801242122910">wal_level = replica                     # minimal, replica, or logical
archive_mode = on               # enables archiving; off, on, or always
archive_command = 'cp %p /mnt/server/archivedir/%f'          # command to use to archive a logfile segment</pre>
</li><li id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_li8651147195920">Run the following commands to reload the Kingbase configuration:<pre class="screen" id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_screen136421245111719">su - <em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i97025132181">kingbase</em>
<em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i16119730195410">/</em><em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i117451658185310">Installation directory</em>/bin/sys_ctl reload -D /<em id="EN-US_TOPIC_0000002200021049__en-us_topic_0000002087949550_i274519580535">Data directory</em>
exit</pre>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0000002164620264.html">Backing Up a Kingbase Instance</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">Copyright &copy; Huawei Technologies Co., Ltd.</div></body>
</html>